import request from '@/utils/request'

// 查询轮播广告列表
export function listAd(query) {
  return request({
    url: '/docs/ad/list',
    method: 'get',
    params: query
  })
}

// 查询轮播广告详细
export function getAd(adId) {
  return request({
    url: '/docs/ad/' + adId,
    method: 'get'
  })
}

// 新增轮播广告
export function addAd(data) {
  return request({
    url: '/docs/ad',
    method: 'post',
    data: data
  })
}

// 修改轮播广告
export function updateAd(data) {
  return request({
    url: '/docs/ad',
    method: 'put',
    data: data
  })
}

// 删除轮播广告
export function delAd(adId) {
  return request({
    url: '/docs/ad/' + adId,
    method: 'delete'
  })
}

export function changeAdStatus(adId, status) {
    const data = {
        adId,
        status
    }
    return request({
        url: '/docs/ad/changeStatus',
        method: 'put',
        data: data
    })
}
